package me.luraframework.commons.annotation;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * @description: Criteria注解
 * @author ranliu
 * @date 10/27/22 12:07 PM
**/
@Target(ElementType.FIELD)
@Retention(RetentionPolicy.RUNTIME)
public @interface Query {
    String propName() default "";

    Type type() default Type.EQUAL;

    /**
     * 模糊搜索，多个字段用逗号隔开
     **/
    String blurry() default "";

    /**
     * 连接查询的属性名
     */
    String joinName() default "";

    /**
     * 默认左连接
     */
    Join join() default Join.LEFT;

    enum Type {
        EQUAL,
        GREATER_THAN_EQ,

        GREATER_THAN,
        LESS_THAN_EQ,
        LESS_THAN,
        INNER_LIKE,
        LEFT_LIKE,
        RIGHT_LIKE,
        IN,
        NOT_IN,
        NOT_EQUAL,
        BETWEEN,
        NOT_NULL,
        IS_NULL
    }

    enum Join {
        LEFT, RIGHT, INNER
    }
}
